home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / ISSUE11 / CLINIC / REPCTRLS.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1996-05-13  |  1.1 KB  |  54 lines

  1. unit RepCtrls;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   StdCtrls, DBCtrls, DBCGrids;
  8.  
  9. type
  10.   TDBRepMemo = class(TDBMemo)
  11.   public
  12.     constructor Create(AOwner: TComponent); override;
  13.   end;
  14.  
  15.   TDBRepImage = class(TDBImage)
  16.   public
  17.     constructor Create(AOwner: TComponent); override;
  18.   end;
  19.  
  20.   TDBRepCtrlGrid = class(TDBCtrlGrid)
  21.   protected
  22.     procedure CMChildKey(var Msg: TWMKeyDown); message cm_ChildKey;
  23.   end;
  24.  
  25. procedure Register;
  26.  
  27. implementation
  28.  
  29. constructor TDBRepMemo.Create(AOwner: TComponent);
  30. begin
  31.   inherited Create(AOwner);
  32.   ControlStyle := ControlStyle + [csReplicatable];
  33. end;
  34.  
  35. constructor TDBRepImage.Create(AOwner: TComponent);
  36. begin
  37.   inherited Create(AOwner);
  38.   ControlStyle := ControlStyle + [csReplicatable];
  39. end;
  40.  
  41. procedure TDBRepCtrlGrid.CMChildKey(var Msg: TWMKeyDown);
  42. begin
  43.   if not ((Msg.CharCode = vk_Return) and
  44.           (Screen.ActiveForm.ActiveControl is TDBMemo)) then
  45.     inherited;
  46. end;
  47.  
  48. procedure Register;
  49. begin
  50.   RegisterComponents('Samples', [TDBRepMemo, TDBRepImage, TDBRepCtrlGrid]);
  51. end;
  52.  
  53. end.
  54.